<template>
	<view class="wrap">
		<uni-status></uni-status>
		<view class="search">
			<input type="text" value="" placeholder="输入搜索内容" v-model="keyWords" />
			<view class="serachText" @click="handleSearch">搜索</view>
		</view>
		<view class="main">
			<uni-search-goods :showGoods="showGoods"></uni-search-goods>
		</view>
	</view>
</template>

<script>
	import {goodsDetail} from "@/static/js/goodsDetail.js"
	export default {
		data() {
			return {
				keyWords:"",
				goodsDetail:[],
				showGoods:[]
			}
		},
		methods: {
			handleSearch(){
				this.showGoods=[]
				this.goodsDetail.forEach(v=>{
					if(v.goods_name.includes(this.keyWords)){
						this.showGoods.push(v)
					}
				})
			}
		},
		created() {
			this.goodsDetail = goodsDetail
		}
	}
</script>

<style lang="less">
	.wrap{
		.search{
			width: 100%;
			height: 88rpx;
			background-color: red;
			display: flex;
			padding: 0 30rpx ;
			justify-content: space-between;
			align-items: center;
			position: sticky;
			top: 88rpx;
			z-index: 9999;
			input{
				width: 600rpx;
				height: 60rpx;
				background-color: white;
				border-radius: 30rpx;
				padding-left: 20rpx;
				font-size: 26rpx ;
			}
			.serachText{
				color: white;
			}
		}
	}
</style>
